//
//  RouteItemSelectCell.m
//  Traveling
//
//  Created by 尹桥印 on 15/6/22.
//  Copyright (c) 2015年 长沙市岳麓区立早网络科技有限公司. All rights reserved.
//

#import "RouteItemSelectCell.h"

@interface RouteItemSelectCell()

@property (weak, nonatomic) IBOutlet UIImageView *img;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;

@property (weak, nonatomic) IBOutlet UILabel *levelLabel;
@property (nonatomic, copy) void(^btnClick)(RouteSelectItemInfo *);
@end
@implementation RouteItemSelectCell

+(instancetype)cellWithTableView:(UITableView *)tableView btnClick:(void (^)(RouteSelectItemInfo *itemInfo))btnClick{
    static NSString *identifier = @"RouteItemSelectCell";
    RouteItemSelectCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    cell.btnClick = btnClick;
    return cell;
}
- (IBAction)addBtnClick:(UIButton *)sender {
    self.btnClick(self.selectItemInfo);
}

-(void)setSelectItemInfo:(RouteSelectItemInfo *)selectItemInfo{
    _selectItemInfo = selectItemInfo;
    [self.img sd_setImageWithURL:[NSURL URLWithString:selectItemInfo.img]];
    self.nameLabel.text = selectItemInfo.name;
    self.levelLabel.text = selectItemInfo.level;
    self.priceLabel.text = [NSString stringWithFormat:@"￥%.2f",selectItemInfo.price];
    self.addressLabel.text = selectItemInfo.address;
}

@end
